//
//  ShopJumpViewController.m
//  MyProject
//
//  Created by dllo on 15/11/6.
//  Copyright (c) 2015年 蓝鸥0825. All rights reserved.
//

#import "ShopJumpViewController.h"
#import "ShopJumpTableViewCell.h"
#import "WHZAfnetWorking.h"
#import "ShopJumpModel.h"

#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height

@interface ShopJumpViewController () <UIWebViewDelegate>
{
    UIWebView *webView;
    UIActivityIndicatorView *activityIndicator;
}
@end

@implementation ShopJumpViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://m.meishij.net/html5/zhuanchang.php?zc_id=50"]];
    [self.view addSubview: webView];
    [webView loadRequest:request];
    
//    self.tabBarController.tabBar.hidden = YES;
//    [self createTabel];
//    [self createData];

    webView.delegate=self;
    UIScrollView *scollview=(UIScrollView *)[[webView subviews]objectAtIndex:0];
    scollview.bounces=NO;
    
}





////      解析数据
//- (void)createData{
//    
//    [WHZAfnetWorking GETJRAfnNetworkingWithUrl:self.str WithParameters:nil Block:^(id result) {
//        
//        NSMutableDictionary *dic = [NSMutableDictionary dictionary];
//        dic = result;
//        self.array = [ShopJumpModel baseModelByArr:dic[@"obj"]];
//        [self.tabel reloadData];
//    }];
//}
//
//
//
//
////      创建tableView
//- (void)createTabel{
//    
//    self.tabel = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
//    [self.view addSubview:self.tabel];
//    [self.tabel release];
//    
//    self.tabel.dataSource = self;
//    self.tabel.delegate = self;
//    self.tabel.rowHeight = HEIGHT / 100 * 145;
//}
//
//
//
//
//
//
//- (void)didReceiveMemoryWarning {
//    [super didReceiveMemoryWarning];
//}
//
//
//
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
//    return self.array.count;
//    
//}
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//    static NSString *reuse = @"reuse";
//    ShopJumpTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
//    if (!cell) {
//        cell = [[ShopJumpTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuse];
//    }
//    cell.backgroundColor = [UIColor yellowColor];
//    cell.modelShopJump = self.array[indexPath.row];
//    return cell;
//}


//      网页开始加载的时候调用
- (void )webViewDidStartLoad:(UIWebView  *)webView{
    
    //创建UIActivityIndicatorView背底半透明View
    UIView *view = [[UIView alloc] initWithFrame:self.view.bounds];
    [view setTag:108];
    [view setBackgroundColor:[UIColor blackColor]];
    [view setAlpha:0.5];
    [self.view addSubview:view];
    
    
    
    
    
    //      指定进度轮的大小
    activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)];
    
    //      指定进度轮中心点
    [activityIndicator setCenter:view.center];
    
    //      设置进度轮显示类型, 系统提供了三种类型
    [activityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
    
    
    //      设置背景色
    activityIndicator.backgroundColor = [UIColor grayColor];
    
    //      设置背景透明
    activityIndicator.alpha = 0.5;
    
    //      设置背景为圆角矩形
    activityIndicator.layer.cornerRadius = 6;
    activityIndicator.layer.masksToBounds = YES;
    
    
    //      将初始化好的indicator add到view中 ,可以将它附着在任何视图上，比如表格单元、或者视图：
    [view addSubview:activityIndicator];
    [activityIndicator startAnimating];
}


//      网页加载完成的时候调用
- (void )webViewDidFinishLoad:(UIWebView  *)webView{
    
    [activityIndicator stopAnimating];
    UIView *view = (UIView*)[self.view viewWithTag:108];
    [view removeFromSuperview];
    NSLog(@"webViewDidFinishLoad");
    
}


//      网页加载错误的时候调用
- (void)webView:(UIWebView *)webView  didFailLoadWithError:(NSError *)error{
    [activityIndicator stopAnimating];
    UIView *view = (UIView*)[self.view viewWithTag:108];
    [view removeFromSuperview];
    NSLog(@"sha");
}





@end






